home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC / src / appgray.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  1.7 KB  |  59 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #include "stdafx.h"
  12.  
  13. #ifdef AFX_INIT_SEG
  14. #pragma code_seg(AFX_INIT_SEG)
  15. #endif
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // Support for gray background in dialogs (and message boxes)
  24.  
  25. #ifndef _AFX_NO_GRAYDLG_SUPPORT
  26.  
  27. LRESULT CALLBACK
  28. _AfxCbtFilterHook(int code, WPARAM wParam, LPARAM lParam);
  29.  
  30. void CWinApp::SetDialogBkColor(COLORREF clrCtlBk, COLORREF clrCtlText)
  31. {
  32. #if !defined(_WIN32_WCE)
  33.     if (!afxContextIsDLL)
  34.     {
  35.         _AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
  36.         if (pThreadState->m_hHookOldCbtFilter == NULL)
  37.         {
  38.             pThreadState->m_hHookOldCbtFilter = ::SetWindowsHookEx(WH_CBT,
  39.                 _AfxCbtFilterHook, NULL, ::GetCurrentThreadId());
  40.             if (pThreadState->m_hHookOldCbtFilter == NULL)
  41.                 AfxThrowMemoryException();
  42.         }
  43.     }
  44. #endif // _WIN32_WCE
  45.  
  46.     // set up for gray backgrounds for dialogs
  47.     _AFX_WIN_STATE* pWinState = _afxWinState;
  48.     AfxDeleteObject((HGDIOBJ*)&pWinState->m_hDlgBkBrush);
  49.  
  50.     pWinState->m_hDlgBkBrush = ::CreateSolidBrush(clrCtlBk);
  51.     pWinState->m_crDlgTextClr = clrCtlText;
  52.     if (pWinState->m_hDlgBkBrush == NULL)
  53.         AfxThrowResourceException();
  54. }
  55.  
  56. #endif //!_AFX_NO_GRAYDLG_SUPPORT
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59.